package no.ffi.gismoidm.attrex;

import java.util.Properties;

/**
 *
 * @author anders
 */
public class Equals extends BooleanOperator {

    Operand op1,op2;
    public Equals(Operand op1, Operand op2) {
        this.op1 = op1;
        this.op2 = op2;
    }
    
    // Utility method for short hand use
    public Equals(String key, String value) {
        this(new AttributeOperand(key), new StringOperand(value));
    }
    
    public BooleanValue getBooleanValue(Properties attributes) throws AttributeEvaluationException {
        if (op1==null || op2==null) return new BooleanValue(false);
        Boolean xx = op1.equals(op2,attributes);
        return new BooleanValue(op1.equals(op2,attributes));
    }

    public String toString() {
        return "eq(" + op1.toString() + "," + op2.toString() + ")";
    }
    
}
